package com.nju.recursion;

public class HanoiTower {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println("The move are:");
		moveDISKs(4, 'A', 'B', 'C');
	}

	public static void moveDISKs(int n, char fromTower, char toTower,
			char auxTower) {
		if (n == 1) {
			System.out.println("Move disk " + n + " from " + fromTower + " to "
					+ toTower);
		} else {
			moveDISKs(n - 1, fromTower, auxTower, toTower);
			System.out.println("Move disk " + n + " from " + fromTower + " to "
					+ toTower);
			moveDISKs(n - 1, auxTower, toTower, fromTower);
		}
	}
}
